<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../3-swiper/dist/css/swiper.min.css">
    <script src="../3-swiper/dist/js/swiper.js"></script>
    <script src="../plugins/vue.min.js"></script>

</head>
<body>

    <div id="box">

        <div class="swiper-container">
        
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="data in dataList" :key="data">{{data}}</div>
            </div>
            {{myName}}
           <!--  <!-- 如果需要分页器 -->
            <div class="swiper-pagination"></div>
            
            <!-- 如果需要导航按钮 -->
            <div class="swiper-button-prev"></div>
            <div class="swiper-button-next"></div>
    
        </div>
    </div>
    


    <script>      
      let vm = new Vue({
        el:"#box",
        data:{
            dataList:[],
            myName:''
        }, 
        mounted() {
        setTimeout(() => {
        this.dataList= ['11','22','33']
        // 下面的固定写法,用来监听当前方法,执行完毕后,上树完成后,执行
        this.$nextTick(()=>{
      console.log("我比updata执行的晚,而且只执行一回")
      var mySwiper = new Swiper ('.swiper-container', {
        //   direction: 'vertical', // 垂直切换选项
          loop: true, // 循环模式选项
          
          // 如果需要分页器
          pagination: {
            el: '.swiper-pagination',
          },
          
          // 如果需要前进后退按钮
          navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
          },
        }) 
     })
        }, 2000);
      },
        updated() {
       console.log("updated")
        },

        
      })
        </script>
</body>
</html>